package test.nettys.zerocopy;

import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.Socket;

/**
 * @Author wangshaopeng
 * @Date 2021/8/23
 */
public class OldClient {


    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 8899);

        FileInputStream inputStream = new FileInputStream("/Users/shaopeng/Downloads/ideaIU-2020.2.4.dmg");
        DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream());
        byte[] bytes = new byte[4096];
        long start = System.currentTimeMillis();
        while (inputStream.read(bytes)>=0) {
            outputStream.write(bytes);
        }
        System.out.println(System.currentTimeMillis()-start);
    }
}
